package org.teamh.gui.ingame.chat;

/**
 * This class represents an instance of a chatmessage, which is currently shown in the ingame. 
 * @author richard
 *
 */
public class ChatMessage {

	private String id;
	private int height;
	private long startTime;
	private long duration;
	
	/**
	 * Creates a new chat message with a unique id, a specified height and the duration of showing. 
	 * @param id
	 * @param height
	 * @param duration
	 */
	public ChatMessage(String id, int height, long duration) {
		this.id = id;
		this.height = height;
		this.startTime = System.currentTimeMillis();
		this.duration = duration;
	}
	
	/**
	 * Deletes this chat message. 
	 * @return
	 */
	public boolean delete() {
		if(Math.abs(startTime - System.currentTimeMillis()) > duration) {
			return true;
		}
		
		return false;
	}
	
	/**
	 * Returns the id of the chat message. 
	 * @return
	 */
	public String getId() {
		return id;
	}
	
	/**
	 * Returns the height of the chat message. 
	 * @return
	 */
	public int getHeight() {
		return height;
	}
}
